Add C++ test file detection support for test generation #992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes missing C++ support in the test generation feature. The
/tests
slash command was not working properly for C++ files because C++ was missing from the test file detection mappings, despite having simulation tests in place.Problem
The test generation functionality had a C++ simulation test (
testGen.cpp.stest.ts
) but C++ was not properly supported in the core test file detection logic. This meant that when users tried to generate tests for C++ code using the/tests
command, the system couldn't correctly identify or create appropriate test files.Solution
Added comprehensive C++ support to the test file detection system:
Language Support Added
_test
suffix (e.g.,foo_test.cpp
)Test
suffix (e.g.,fooTest.cpp
).test
suffix (e.g.,foo.test.cpp
)testFolder
(following C++ project conventions)File Extension Support
.cpp
→cpp
.cc
→cpp
.cxx
→cpp
Test Coverage
Added comprehensive unit tests covering:
Files Changed
src/extension/prompt/node/testFiles.ts
- Added C++ totestHintsByLanguage
andsuffix2Language
mappingssrc/extension/prompt/node/test/testFiles.spec.ts
- Added C++ test casesVerification
This change enables the
/tests
command to work properly with C++ source files, allowing users to generate unit tests for their C++ code using the same workflow available for other supported languages.Created from VS Code via the GitHub Pull Request extension.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.